package net.yb.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

/**
 * 控制器
 */
@Slf4j
@Controller
public class HelloController {

    @Autowired
    private Date date;

    @RequestMapping("/hello")
    @ResponseBody
    public String hello(){

        log.info("执行了HelloController中的hello方法。。。。。。。");

        try{
            int a = 5/0;
        }catch(Exception e){
            log.error("执行出错啦。。。。。。" +e.getMessage());
        }

        return "Hello World ----> " + date;
    }

}
